Type Inference for Overloading without Restrictions, Declarations or Annotations
نویسندگان
چکیده
This article presents a type system based on the DamasMilner system [DM82], that supports overloading. Types of overloaded symbols are constrained polymorphic types. The work is related to Haskell type classes [Wad89,NP93,HHJW96], System O [OWW95] and other type systems with similar forms of constrained types [Kae88,Smi91,Jon94,DCO96]. Restrictions imposed in these systems with respect to overloading are eliminated. User-defined global and local overloading is supported without restrictions. There is no need for declarations or annotations of any sort. No language construct is added in order to cope with overloading. The type system uses a context-dependent overloading policy, which is specified by means of a predicate used in a single inference rule. Overloading of functions defined over different type constructors is supported, as done with Haskell’s constructor classes. No monomorphism restriction is required in order to solve ambiguity problems. The system uses an open-world approach, in which new overloaded definitions can be introduced with types automatically reflecting the new definitions. The article also presents a type inference algorithm for the system, which is proved to be sound and to compute principal typings.
منابع مشابه
Adding overloading to Java type inference
Zusammenfassung In this paper we extend our Java with type inference by adding methods. Functions had been realized as lambda expressions defined in fields until now, which led to the restrictions that no overloading is available. Therefore the main challenge of adding methods is to deal with overloading. We present the change of the data-structures and the algorithm.
متن کاملLower Bounds on Type Checking Overloading
Smith has proposed an elegant extension of the ML type system for polymor-phic functional languages with overloading. Type inference in his system requires solving a satissability problem that is undecidable if no restrictions are imposed on overloading. This short note explores the eeect of recursion and the structure of type assumptions in overloadings on the problem's complexity.
متن کاملOpen and Closed Worlds for Overloading: a Definition and Support for Coexistence
The type system of Haskell and some related systems are based on an open world approach for overloading. In an open world, the principal type of each overloaded symbol must be explicitly annotated (in Haskell, annotations occur in type class declarations) and a definition of an overloaded symbol is required to exist only when overloading is resolved. In a closed world, on the other hand, each p...
متن کاملModule Constructs for Object-oriented and Functional Programming Languages Dissertation Proposal
Object-oriented languages ooer mechanisms to help structure large programs. However, the semantics of these constructs are often not very precisely deened. For example, the use of inheritance as a substitute for subtype polymorphism in many object-oriented languages either leads to an unsound or a too innexible type system. In addition, ideas from module constructs of functional languages could...
متن کاملObject-Oriented Style Overloading for Haskell
Haskell has a sophisticated mechanism for overloading identifiers with multiple definitions at distinct types. Objectoriented programming has a similar notion of overriding and overloading for methods names. Unfortunately, it is not possible to encode object-oriented overloading directly using Haskell overloading. This deficiency becomes particularly tiresome when Haskell programs wish to call ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1999